package com.ghy.nba.controllers;


import com.ghy.nba.dao.BallStarRepository;
import com.ghy.nba.dao.PowerRepository;
import com.ghy.nba.entities.BallStar;
import com.ghy.nba.entities.Power;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class HomeControllers {

    @Autowired
    BallStarRepository ballStarRepository;

    @Autowired
    PowerRepository powerRepository;

    @RequestMapping("/")
    public String displayHome(Model model){
        List<BallStar> ballStars = ballStarRepository.findAll();
        model.addAttribute("ballstars",ballStars);

        List<Power> powers = powerRepository.findAll();
        model.addAttribute("powers",powers);

        return "main/home";
    }
}
